package com.hzdesk.media.matvector.koreabatch.client.my_paperless.adapter;

import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.View;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.R;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseAdapter;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseViewHolder;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.view_holder.CursorColorViewHolder;

/**
 * Created by Administrator on 2018/8/21.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

public class CursorColorAdapter<T> extends BaseAdapter{

    private int defaultcolor;
    public CursorColorAdapter(Context mContext) {
        super(mContext);
    }

    @Override
    protected int getItemLayout() {
        return R.layout.cursor_color_item;
    }

    @Override
    protected BaseViewHolder getItemViewHolder(View view) {
        return new CursorColorViewHolder(view);
    }

    @Override
    protected void onMyBindViewHolder(BaseViewHolder holder, int position) {
        CursorColorViewHolder cursorColorViewHolder = (CursorColorViewHolder) holder;
        Integer color = (Integer) mlist.get(position);
        cursorColorViewHolder.getCursor_color().setCursorColor(color);
        if(position == defaultcolor){
            cursorColorViewHolder.getIv_selector().setVisibility(View.VISIBLE);
        }else{
            cursorColorViewHolder.getIv_selector().setVisibility(View.GONE);
        }

    }

    /**
     * @desc 刷新选中区
     * */
    public void updateColr(int postion){
        defaultcolor = postion;
        notifyDataSetChanged();
    }
    /**
     * @desc 获得选中的区域
     * */
    public int getColorIndex(){
        return defaultcolor;
    }

}
